package com.lss.myapplication.db.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.lss.myapplication.db.City;

import java.util.List;

@Dao
public interface CityDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(City city);

    @Update(onConflict = OnConflictStrategy.REPLACE)
    void update(City city);

    @Delete
    void delete(City city);

    @Query("SELECT * FROM city WHERE id = :id")
    City getCityById(int id);

    @Query("SELECT * FROM city")
    List<City> getAllCities();
    @Query("SELECT * FROM city WHERE provinceId = :id")
    List<City> getCitiesByProvinceId(int id);
}
